/*
 * Copyright 2018 JDCLOUD.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http:#www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * JMR API
 * 提供大数据基础服务中JMR操作的相关接口
 *
 * OpenAPI spec version: v1
 * Contact: 
 *
 * NOTE: This class is auto generated by the jdcloud code generator program.
 */


using JDCloudSDK.Core.Auth;
using JDCloudSDK.Core.Client;
using JDCloudSDK.Core.Http;
using JDCloudSDK.Jmr.Apis;
using JDCloudSDK.Jmr.Model;
using System;
using System.Collections.Generic;
using System.Text;
#if NET40||NET35
#else
using System.Threading.Tasks;
#endif

namespace JDCloudSDK.Jmr.Client
{
    /// <summary>
    ///  JMR API
    ///  提供大数据基础服务中JMR操作的相关接口
    ///  Jmr Api 客户端
    ///</summary>
    public class JmrClient : JdcloudClient
    {

        /// <summary>
        ///  默认私有构造函数
        /// </summary>
        private JmrClient()
        {

        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        /// <param name="credentialsProvider">认证信息</param>
        /// <param name="httpRequestConfig">http 客户端配置信息</param>
        /// <param name="environment">sdk 环境配置信息</param>
        public JmrClient(CredentialsProvider credentialsProvider, HttpRequestConfig httpRequestConfig,SDKEnvironment environment)
        {
            this.httpRequestConfig = httpRequestConfig;
            this.credentialsProvider = credentialsProvider;
            this.environment = environment;
        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        /// <param name="httpRequestConfig">http 客户端配置信息</param>
        /// <param name="credentialsProvider">认证信息</param>
        public JmrClient(CredentialsProvider credentialsProvider,HttpRequestConfig httpRequestConfig)
        {
            this.httpRequestConfig = httpRequestConfig;
            this.credentialsProvider = credentialsProvider;
        }

        /// <summary>
        /// 默认构造函数，
        /// 注意如果使用此方法 httpRequestConfig 使用的http 请求 schema 为Https
        /// </summary>
        /// <param name="credentialsProvider">认证信息</param>
        public JmrClient(CredentialsProvider credentialsProvider)
        {
            this.credentialsProvider = credentialsProvider;
        }

        /// <summary>
        ///  版本号 1.2.3
        ///</summary>
        public const string ClientVersion = "1.2.3";

        private const string apiVersion = "v1";
        private const string userAgentPrefix = "JdcloudSdkDotNet";
        private const string defaultEndpoint = "jmr.jdcloud-api.com";
        private const string serviceName = "jmr";
        private const string userAgent = userAgentPrefix + "/" + ClientVersion + " " + serviceName + "/" + apiVersion;


        private SDKEnvironment environment = new SDKEnvironment(defaultEndpoint);
        private CredentialsProvider credentialsProvider;
        private HttpRequestConfig httpRequestConfig;

        /// <summary>
        ///  获取证书信息
        ///</summary>
        public override CredentialsProvider CredentialsProvider   { get { return credentialsProvider; } }

        /// <summary>
        ///  获取http 客户端配置信息
        ///</summary>
        public override HttpRequestConfig HttpRequestConfig { get { return httpRequestConfig; } }

        /// <summary>
        ///  获取sdk环境配置信息
        ///</summary>
        public override SDKEnvironment SDKEnvironment { get { return environment; } }

        /// <summary>
        ///  获取用户自定义浏览器识别字符串
        ///</summary>
        public override string UserAgent { get { return userAgent; } }

        /// <summary>
        ///  获取服务名称
        ///</summary>
        public override string ServiceName { get { return serviceName; } }

        /// <summary>
        ///  获取版本号
        ///</summary>
        public override string Version { get { return apiVersion; } }



#if NET40||NET35
        /// <summary>
        ///  查询JMR的版本信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GetJmrVersionListResponse GetJmrVersionList(GetJmrVersionListRequest request) {
            return  new GetJmrVersionListExecutor().Client(this).Execute<GetJmrVersionListResponse, GetJmrVersionListResult, GetJmrVersionListRequest>(request);
        }
#else
        /// <summary>
        ///  查询JMR的版本信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GetJmrVersionListResponse> GetJmrVersionList(GetJmrVersionListRequest request) {
            return await new GetJmrVersionListExecutor().Client(this).Execute<GetJmrVersionListResponse, GetJmrVersionListResult, GetJmrVersionListRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询JMR的监控模板信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public MonitorLabelListResponse MonitorLabelList(MonitorLabelListRequest request) {
            return  new MonitorLabelListExecutor().Client(this).Execute<MonitorLabelListResponse, MonitorLabelListResult, MonitorLabelListRequest>(request);
        }
#else
        /// <summary>
        ///  查询JMR的监控模板信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<MonitorLabelListResponse> MonitorLabelList(MonitorLabelListRequest request) {
            return await new MonitorLabelListExecutor().Client(this).Execute<MonitorLabelListResponse, MonitorLabelListResult, MonitorLabelListRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  缩容集群
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ClusterReductionResponse ClusterReduction(ClusterReductionRequest request) {
            return  new ClusterReductionExecutor().Client(this).Execute<ClusterReductionResponse, ClusterReductionResult, ClusterReductionRequest>(request);
        }
#else
        /// <summary>
        ///  缩容集群
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ClusterReductionResponse> ClusterReduction(ClusterReductionRequest request) {
            return await new ClusterReductionExecutor().Client(this).Execute<ClusterReductionResponse, ClusterReductionResult, ClusterReductionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询用户集群的列表
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeClustersResponse DescribeClusters(DescribeClustersRequest request) {
            return  new DescribeClustersExecutor().Client(this).Execute<DescribeClustersResponse, DescribeClustersResult, DescribeClustersRequest>(request);
        }
#else
        /// <summary>
        ///  查询用户集群的列表
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeClustersResponse> DescribeClusters(DescribeClustersRequest request) {
            return await new DescribeClustersExecutor().Client(this).Execute<DescribeClustersResponse, DescribeClustersResult, DescribeClustersRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  释放集群
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ReleaseClusterResponse ReleaseCluster(ReleaseClusterRequest request) {
            return  new ReleaseClusterExecutor().Client(this).Execute<ReleaseClusterResponse, ReleaseClusterResult, ReleaseClusterRequest>(request);
        }
#else
        /// <summary>
        ///  释放集群
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ReleaseClusterResponse> ReleaseCluster(ReleaseClusterRequest request) {
            return await new ReleaseClusterExecutor().Client(this).Execute<ReleaseClusterResponse, ReleaseClusterResult, ReleaseClusterRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询用户的集群列表及相关服务的一些信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public IdataClusterResponse IdataCluster(IdataClusterRequest request) {
            return  new IdataClusterExecutor().Client(this).Execute<IdataClusterResponse, IdataClusterResult, IdataClusterRequest>(request);
        }
#else
        /// <summary>
        ///  查询用户的集群列表及相关服务的一些信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<IdataClusterResponse> IdataCluster(IdataClusterRequest request) {
            return await new IdataClusterExecutor().Client(this).Execute<IdataClusterResponse, IdataClusterResult, IdataClusterRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取对应版本的软件清单信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GetSoftwareInfoResponse GetSoftwareInfo(GetSoftwareInfoRequest request) {
            return  new GetSoftwareInfoExecutor().Client(this).Execute<GetSoftwareInfoResponse, GetSoftwareInfoResult, GetSoftwareInfoRequest>(request);
        }
#else
        /// <summary>
        ///  获取对应版本的软件清单信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GetSoftwareInfoResponse> GetSoftwareInfo(GetSoftwareInfoRequest request) {
            return await new GetSoftwareInfoExecutor().Client(this).Execute<GetSoftwareInfoResponse, GetSoftwareInfoResult, GetSoftwareInfoRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  扩容集群
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ClusterExpansionResponse ClusterExpansion(ClusterExpansionRequest request) {
            return  new ClusterExpansionExecutor().Client(this).Execute<ClusterExpansionResponse, ClusterExpansionResult, ClusterExpansionRequest>(request);
        }
#else
        /// <summary>
        ///  扩容集群
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ClusterExpansionResponse> ClusterExpansion(ClusterExpansionRequest request) {
            return await new ClusterExpansionExecutor().Client(this).Execute<ClusterExpansionResponse, ClusterExpansionResult, ClusterExpansionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  创建集群
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CreateClusterResponse CreateCluster(CreateClusterRequest request) {
            return  new CreateClusterExecutor().Client(this).Execute<CreateClusterResponse, CreateClusterResult, CreateClusterRequest>(request);
        }
#else
        /// <summary>
        ///  创建集群
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CreateClusterResponse> CreateCluster(CreateClusterRequest request) {
            return await new CreateClusterExecutor().Client(this).Execute<CreateClusterResponse, CreateClusterResult, CreateClusterRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  查询指定集群的详细信息
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeClusterResponse DescribeCluster(DescribeClusterRequest request) {
            return  new DescribeClusterExecutor().Client(this).Execute<DescribeClusterResponse, DescribeClusterResult, DescribeClusterRequest>(request);
        }
#else
        /// <summary>
        ///  查询指定集群的详细信息
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeClusterResponse> DescribeCluster(DescribeClusterRequest request) {
            return await new DescribeClusterExecutor().Client(this).Execute<DescribeClusterResponse, DescribeClusterResult, DescribeClusterRequest>(request).ConfigureAwait(false);
        }
#endif

            /// <summary>
            ///  默认JmrClient 构造器 接口
            ///</summary>
            public interface Builder
            {

                /// <summary>
                /// 设置认证信息参数
                /// </summary>
                /// <param name="provider">认证信息提供对象</param>
                /// <returns>jmrClient 构造器</returns>
                Builder CredentialsProvider(CredentialsProvider provider);

                /// <summary>
                /// 设置请求环境参数
                /// </summary>
                /// <param name="environment">环境参数信息</param>
                /// <returns>jmrClient 构造器</returns>
                Builder Environment(Core.Client.SDKEnvironment environment);

                /// <summary>
                /// http 请求配置信息
                /// </summary>
                /// <param name="config">http 请求配置信息</param>
                /// <returns>jmrClient 构造器</returns>
                Builder HttpRequestConfig(HttpRequestConfig config);

                /// <summary>
                ///  构造JmrClient 对象
                ///</summary>
                JmrClient Build();
            }

            /// <summary>
            ///  默认JmrClient 构造器
            ///</summary>
            public class DefaultBuilder : Builder
            {
                /// <summary>
                ///  JmrClient service client
                /// </summary>
                private  JmrClient jmrClient;

                /// <summary>
                ///  默认JmrClient 构造器构造对象
                ///</summary>
                public DefaultBuilder()
                {
                    jmrClient = new JmrClient();
                }

                /// <summary>
                ///  构造JmrClient 对象
                ///</summary>
                public JmrClient Build()
                {
                    if (jmrClient.CredentialsProvider == null)
                    {
                        //if credentialsProvider not set, try load jdcloud global default  credentials provider
                        jmrClient.credentialsProvider = JdCloud.DefaultInstance.GetCredentialsProvider();
                        if (jmrClient.credentialsProvider == null)
                        {
                            throw new ArgumentNullException("JmrClient build error: jdcloud credentials provider not set");
                        }
                    }
                    if (jmrClient.HttpRequestConfig == null)
                    {
                        jmrClient.httpRequestConfig = JdCloud.DefaultInstance.GetHttpRequestConfig();
                        if (jmrClient.httpRequestConfig == null)
                        {
                        throw new ArgumentNullException("JmrClient build error: http request config not set");
                        }
                    }
                    return jmrClient;
                }

                /// <summary>
                /// 设置认证信息参数
                /// </summary>
                /// <param name="provider">认证信息提供对象</param>
                /// <returns>jmrClient 构造器</returns>
                public Builder CredentialsProvider(CredentialsProvider provider)
                {
                    jmrClient.credentialsProvider = provider;
                    return this;
                }

                /// <summary>
                /// 设置请求环境参数
                /// </summary>
                /// <param name="environment">环境参数信息</param>
                /// <returns>jmrClient 构造器</returns>
                public Builder Environment(SDKEnvironment environment)
                {
                    jmrClient.environment = environment;
                    return this;
                }

                /// <summary>
                /// http 请求配置信息
                /// </summary>
                /// <param name="config">http 请求配置信息</param>
                /// <returns>jmrClient 构造器</returns>
                public Builder HttpRequestConfig(HttpRequestConfig config)
                {
                    jmrClient.httpRequestConfig = config;
                    return this;
                }
            }
    }
}
